define(["dojo/_base/declare", "dijit/form/Form", "dijit/form/TextBox", "dijit/form/Button"], function(declare){
    declare("my.form.EditUserForm", [dijit.form.Form], {
    	startup : function(){
    		dojo.xhrPost(
				    {
				        url : "getCurrentUserAction.action",
				        handleAs : "json",
				        load : dojo.hitch(this, this.onLoadCurrentUser),
				    });
    	},
    	
    	onLoadCurrentUser : function(responseObject, ioArgs){
    		dijit.byId("editUser.id").setValue(responseObject.user.id);
    		dijit.byId("editUser.username").set("value", responseObject.user.username);
    		dijit.byId("editUser.login").set("value", responseObject.user.login);
    	},
    	
    	onSubmit : function(){
    		return this.isValid() && dijit.byId("editUserPassword").get('value') == dijit.byId("editUserConfirmPassword").get('value');
    	}
    	
    });
});